clc
clear

load('EB.mat');

n = size(x,1);

x2d(:,:)   = x(:,uint32(n/2),:);
y2d(:,:)   = y(:,uint32(n/2),:);
z2d(:,:)   = z(:,uint32(n/2),:);
E2d(:,:,1) = E(:,uint32(n/2),:,2);
E2d(:,:,2) = E(:,uint32(n/2),:,3);
E2d(:,:,3) = E(:,uint32(n/2),:,4);
B2d(:,:,1) = B(:,uint32(n/2),:,2);
B2d(:,:,2) = B(:,uint32(n/2),:,3);
B2d(:,:,3) = B(:,uint32(n/2),:,4);


figure()
hold on
axis equal
u = sum(E2d.^2+B2d.^2,3);
caxis([0,0.5])
u(u>1)=1;
surf(x2d,z2d,u,'edgecolor','none')
